//
//  ViewController.m
//  07-UIViewController
//
//  Created by 韩旭 on 16/7/22.
//  Copyright © 2016年 lanou. All rights reserved.
//

#import "ViewController.h"
#import "FirstViewController.h"

@interface ViewController ()

@end

@implementation ViewController

#pragma mark - life Cycle
// loadView ViewDidLoad viewWillAppear
//以上三个方法, 会插在上一个视图控制器的 viewWillDisAppear与 viewDidDisappear中间
// push一个新的视图控制器时
- (void)loadView {
    [super loadView];
    NSLog(@"load -- 0  --%@  --- %s", [self class], __func__);
}
- (void) viewWillAppear:(BOOL)animated {
    NSLog(@"1%@--%s", [self class], __func__);
}
- (void)viewDidAppear:(BOOL)animated {
    [super viewDidAppear:YES];
    NSLog(@"2%@- -%s", [self class], __func__);
}
- (void)viewDidDisappear:(BOOL)animated {
    [super viewWillAppear:animated];
    NSLog(@"3%@ -- %s", [self class], __func__);
}
- (void)viewWillDisappear:(BOOL)animated {
    [super viewWillDisappear:animated];
    NSLog(@"4%@ -- %s", [self class], __func__);
}


#pragma mark - buttonChilked
- (void)barButtonChilked:(UIBarButtonItem *)barBar {
    FirstViewController *first = [[FirstViewController alloc] init];
    [self.navigationController pushViewController:first animated:YES];
}
- (void)viewDidLoad {
    [super viewDidLoad];
    NSLog(@"%s", __func__);
    self.view.backgroundColor = [UIColor redColor];
    self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemAdd target:self action:@selector(barButtonChilked:)];
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end
